<!DOCTYPE html>
<html>
<head>
	<title>productDetail.html</title>

	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="this is my page">
	<meta http-equiv="content-type" content="text/html; charset=UTF-8">
	<link rel="stylesheet" href="../../../plugins/bootstrap/css/bootstrap.min.css"
		type="text/css"></link>
	<link rel="stylesheet" href="../../../plugins/FlatUI/dist/css/flat-ui.css"
		type="text/css"></link>
	<link rel="shortcut icon" href="../../../plugins/FlatUI/dist/img/favicon.ico">
	<link rel="stylesheet" href="../../../css/style.css">
	<script type="text/javascript" src="../../../js/jquery.js"></script>
	<script src="../../../plugins/bootstrap/js/bootstrap.min.js"></script>
	<script type="text/javascript" src="../../../js/base.js"></script>
	<script type="text/javascript">
	

	$(function(){
	var productId = sessionStorage.getItem('productId');
	
      $.ajax({
            url:commonurl+"/selectProductById.product",
            type:"POST",
            data:{ "productId":productId
                  


            },
            dataType:"json",
            success:function(data){
			 	if(data.success){
			 		var obj=data.obj;
					console.log(data.obj);
					
					console.log(obj.companyId+"==proID");
					var proId=obj.companyId;
					var typeId=obj.typeId;
				   var  perId=	obj.periodId;
					
					
					
						//加载公司数据
	/* $.ajax({
		url:commonurl+"/selectAllCompany.company",
		type:"POST",
		data:{
			all:"all"
		},
		dataType:"json",
		success:function(data){
			if(!data.success){
				alert('加载公司数据失败');
				return;
			}
			var obj=data.obj;
			var datas={
            	sources:obj,
            	"proId": proId
        	};
            $("#company").html(template("companyListTemplate",datas));
            console.log(proId+":proID");
            $("#company option[value="+proId+"]").prop("selected", true);
            $("#company").select2({dropdownCssClass: 'dropdown-inverse'});
         
		}
	}); */
	//加载产品类型数据
	/* $.ajax({
		url:commonurl+"/selectAll.productType",
		type:"POST",
		data:{
			all:"all"
		},
		dataType:"json",
		success:function(data){
			if(!data.success){
				alert('加载产品类型数据失败');
				return;
			}
			var obj=data.obj;
			var datas={
            	sources:obj
        	};
            $("#productType").html(template("productTypeTemplate",datas));
             $("#productType option[value="+typeId+"]").prop("selected", true);
            $("#productType").select2({dropdownCssClass: 'dropdown-inverse'});
            //  $("#company option[value="+obj.companyId+"]").attr("selected", true);  
         
		}
	}); */
	
	//加载贷款周期数据
	/* $.ajax({
		url:commonurl+"/selectAllPeriod.period",
		type:"POST",
		data:{
			all:"all"
		},
		dataType:"json",
		success:function(data){
			if(!data.success){
				alert('加载公司数据失败');
				return;
			}
			var obj=data.obj;
			var datas={
            	sources:obj
        	};
            $("#productDuration").html(template("productDurationTemplate",datas));
            
              $("#productDuration option[value="+perId+"]").prop("selected", true);
            $("#productDuration").select2({dropdownCssClass: 'dropdown-inverse'});
              //  $("#company option[value="+obj.companyId+"]").attr("selected", true);  
         
		}
	}); */
					
					
					
					$("#productID").html(obj.id);
					$("#productName").html(obj.proName);
					$("#productRate").html(obj.rateFrom+"%-"+obj.rateTo+"%");
					$("#companyName").html(obj.company.companyName);
					
					
				//	$("#company").val(obj.companyId);
					
					
				console.log(obj.amountTo+"=size="+obj.amountFrom)
					$("#loansize").html(obj.amountFrom+"万-"+obj.amountTo+"万");
					$("#productType").html(obj.productType.productTypeName);
					$("#productDuration").html(obj.period.periodName);
				
				
						//$("#productType").val(obj.typeId);
						//$("#productDuration").val(obj.periodId);
						$("#linkman").html(obj.linkMan);
						$("#bank").html(obj.linkBank);
						$("#content").html(obj.content);
						
						
	/* 	  $("#companyId").val(obj.id);
		  $("#companyName").val(obj.companyName);
		  $("#productRate").val(obj.companyRate);
		  $("#content").text(obj.companyIntro); */
		  
		  
	/* 	  "productName":$("#productName").val(),
            	
            	"minProductRate":$("#minProductRate").val(),
            	"maxProductRate":$("#maxProductRate").val(),
            	
            	"company":$("#company").val(),
            	"minLoansize":$("#minLoansize").val(),
            	"maxLoansize":$("#maxLoansize").val(),
            	"productType":$("#productType").val(),
            	"productDuration":$("#productDuration").val(),
            	"linkman":$("#linkman").val(),
            	"bank":$("#bank").val(),
            	"content":$("#content").text() */
		  
		  
		  
					/* sessionStorage.setItem("name", name);
					sessionStorage.setItem("id",id); 
					sessionStorage.setItem("userImg",imageUrl); 
					location.href= "main.html"; */
				} 
            }

        })
	
	
	})
	
	
	
	</script>
	
	
	
	
</head>

<body style="padding: 5px 10px">

	<div class="panel panel-primary">
	  <div class="panel-heading">
	    <h3 class="panel-title">融资产品详情</h3>
	  </div>
	  <div class="panel-body">
	  		
	  		<form class="form-horizontal" role="form" action="productManage.html">
	  		
	  		<div class="form-group">
              <label for="productID" class="col-lg-2 control-label">产品编号</label>
              <div id="productID" class="col-lg-10">
                
              </div>
            </div>
	  		
            <div class="form-group">
              <label for="productName" class="col-lg-2 control-label">产品名称</label>
              <div id="productName" class="col-lg-10">
               		
              </div>
            </div>
            
            <div class="form-group">
            	<label for="productRate" class="col-lg-2 control-label">贷款利率</label>
            	<div id="productRate" class="col-lg-10">
			       
			    </div>
          	</div>
            
            
            <div class="form-group">
              <label for="company" class="col-lg-2 control-label">发行单位</label>
              <div id="companyName" class="col-lg-10">
          		      
              </div>
            </div>
            
             <div class="form-group">
            	<label for="loansize" class="col-lg-2 control-label">贷款规模</label>
            	<div class="col-lg-10">
			        <div id="loansize" class="input-group col-lg-3" style="float: left;">
			           
			        </div>
			    </div>
          	</div>
            
            <div class="form-group">
              <label for="productType" class="col-lg-2 control-label">产品类型</label>
              <div id="productType" class="col-lg-10">
		              
              </div>
            </div>
            
            <div class="form-group">
              <label for="productDuration" class="col-lg-2 control-label">贷款周期</label>
              <div id="productDuration" class="col-lg-10">
		              
              </div>
            </div>
            
            
            <div class="form-group">
              <label for="linkman" class="col-lg-2 control-label">联系人</label>
              <div id="linkman" class="col-lg-10">
             		   
              </div>
            </div>
            
            <div class="form-group">
              <label for="bank" class="col-lg-2 control-label">联系银行</label>
              <div id="bank" class="col-lg-10">
         		       
              </div>
            </div>
            
            <div class="form-group">
              <label for="content" class="col-lg-2 control-label">内容</label>
              <div class="col-lg-10">
           		 <div id="content" style=" max-height:300px;height: 200px;">
           		
           		 </div>
        	 </div>
     </div>
          </form>
	  </div>
	</div>
	
</body>
</html>
